package com.project.homework4_9.service.impl;

import com.project.homework4_9.service.IUserService;
import com.project.homework4_9.util.UserProxy;
//run(）方法抛出数组下标越界异常，
//work()方法抛出空指针异常，sleep方法正确运行。
//3、创建代理类，对用户类进行代理。在用户类方法抛出异常时，添加日志记录，
//日志日期默认为当天，日志内容书写为：XXX类在HH:mm:ss，执行XX方法时，抛出XX异常


public class UserServiceImpl implements IUserService {
    /**异常信息*/
    private  String exception ;

    public void run()   {
        throw new ArrayIndexOutOfBoundsException();
    }

    public void  work()  {
       throw new NullPointerException();
    }

    public void sleep(){
        System.out.println("正常运行");
    }

    public static void main(String[] args) {

        UserProxy proxy = new UserProxy(new UserServiceImpl());
        IUserService user = (IUserService) proxy.getProxy();
        user.run();
        user.work();
        user.sleep();
    }
}
